import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const routes = [
	{
	  path:"/cinema",
	  component:() => import("@/views/cinema/cinema.vue")
	},
	{
	  path:"/films",
	  component:() => import("@/views/films/films.vue"),
	  children:[
	    {
	      path:"/films/nowplaying",
	      component:() => import("@/views/films/nowplaying.vue")
	    },
	    {
	      path:"/films/comingsoon",
	      component:() => import("@/views/films/comingsoon.vue")
	    },
	    {
	      path:"",
	      redirect:"/films/nowplaying" // 进行一级路由内部的重定向操作  /films ==> /films/nowplaying
	    }
	  ]
	},
	{
	  path:"/center",
	  component:() => import("@/views/center/center.vue"),
	},
	{
	  path:"/login",
	  component:() => import("@/views/center/login.vue")
	},
	{
	  path:"/",
	  redirect:'/films' // 重定向
	},
	{
	  path:"*",
	  component:() => import("@/views/error.vue")
	}
]

const router = new VueRouter({
  routes
})

export default router
